package com.salt.admin.api.feign.client;

import com.salt.admin.api.feign.hystrix.RoleClientHystrix;
import com.salt.admin.api.feign.interceptor.FeignTokenInterceptor;
import com.salt.admin.api.model.Role;
import com.salt.common.constant.Common;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Set;

/**
 * @Description
 * @Author salt
 * @Date 2021-04-08
 * @Version 1.0.1
 */
@Repository
@FeignClient(name = Common.Service.SALT_ADMIN_SERVICE_NAME,
        path = Common.Service.SALT_ADMIN_ROLE_URL_PREFIX,
        fallbackFactory = RoleClientHystrix.class,
        configuration = FeignTokenInterceptor.class)
public interface RoleClient {

    @PostMapping("findAllList")
    public List<Role> findAllList(Role role);

    @PostMapping("get")
    public Role get(@RequestParam("id")String id);

    @PostMapping("queryByIds")
    public List<Role> queryByIds(@RequestParam("ids") List<String> ids);

    @PostMapping("selectUserIds")
    public Set<String> selectUserIds(@RequestParam("roleIds") Set<String> roleIds);
}
